<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
    <title>{$options.title}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="{$options.tagline}" />
    <meta name="author" content="{$options.title}">
    <?php if ($options['colors']) { ?>
    <link rel="icon" href="__ADDONROOT__/img/favicon.png" type="image/x-icon">
    <?php } else { ?>
    <link rel="icon" href="__ADDONROOT__/img/favicon-{$options.theme}.png" type="image/x-icon">
    <?php } ?>
    <!-- Mobile -->
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Font -->
    <link href='http://fonts.useso.com/css?family=Roboto+Slab:400,700,300,100' rel='stylesheet' type='text/css'>

    <!-- LESS -->
    <?php if ($options['colors']) { ?>
        <style type="text/less">
            <?php foreach($options['colors'] as $k => $v) { ?>
            @<?php echo $k;?>: <?php echo $v;?>;
            <?php } ?>
            @import "__ADDONROOT__/less/import/daux-base.less";
        </style>
        <script src="__ADDONROOT__/js/less.min.js"></script>
    <?php } else { ?>

        <link rel="stylesheet" href="__ADDONROOT__/css/daux-{$options.theme}.css">
    <?php } ?>


    <!-- hightlight.js -->
    <script src="__ADDONROOT__/js/highlight.min.js"></script>
    <script type="text/javascript">
        hljs.configure({
          tabReplace: '    ', // 4 spaces
        })
    </script>
    <script>hljs.initHighlightingOnLoad();</script>
    <link rel="stylesheet" href="__ADDONROOT__/css/monokai_sublime.css">
    <!-- Navigation -->
    <script src="//lib.sinaapp.com/js/jquery/1.10/jquery-1.10.0.min.js"></script>
    <script>
    if (typeof jQuery == 'undefined') {
        document.write(unescape("%3Cscript src='__STATIC__/jquery-1.10.2.min.js' type='text/javascript'%3E%3C/script%3E"));
    }
    </script>
    <script src="__STATIC__/bootstrap/js/bootstrap.min.js"></script>
    <script src="__ADDONROOT__/js/custom.js"></script>
    <!--[if lt IE 9]>
    <script src="//__STATIC__/bootstrap/js/html5shiv.js"></script>
    <![endif]-->
</head>
<body>
    <?php if ($homepage) { ?>
        <!-- Hompage -->
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container">
                    <a class="brand pull-left" href="<?php echo $base_url;?><?php echo $homepage_url;?>">{$options.title}</a>
                    <p class="navbar-text pull-right">
                        由<a href="http://daux.io">Daux.io</a>生成
                    </p>
                </div>
            </div>
        </div>

        <div class="homepage-hero well container-fluid">
            <div class="container">
                <div class="row">
                    <div class="text-center span12">
                        <?php if ($options['tagline']) { ?>
                            <h2>{$options.tagline}</h2>
                        <?php } ?>
                    </div>
                </div>
                <div class="row">
                    <div class="span10 offset1">
                        <?php if ($options['image']) { ?>
                            <img class="homepage-image" src="__ADDONROOT__/{$options.image}" alt="{$options.title}">
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>

        <div class="hero-buttons container-fluid">
            <div class="container">
                <div class="row">
                    <div class="text-center span12">
                        <?php if ($options['repo']) { ?>
                            <a href="https://github.com/{$options.repo}" class="btn btn-secondary btn-hero">
                                前往GitHub查看详情
                            </a>
                        <?php } ?>
                        <?php if (count($options['languages']) > 0) { ?>
                            <?php foreach ($options['languages'] as $language_key => $language_name) { ?>
                            <a href="<?php echo $base_url . "/" . $language_key . "/"; ?>" class="btn btn-primary btn-hero">
                                <?php echo $language_name; ?>
                            </a>
                            <?php } ?>
                        <?php } else { ?>
                        <a href="<?php echo $docs_url;?>" class="btn btn-primary btn-hero">
                            查看daux.io中文文档
                        </a>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>

        <div class="homepage-content container-fluid">
            <div class="container">
                <div class="row">
                    <div class="span10 offset1">
                        <?php echo $page['html'];?>
                    </div>
                </div>
            </div>
        </div>

        <div class="homepage-footer well container-fluid">
            <div class="container">
                <div class="row">
                    <div class="span5 offset1">
                        <?php if (!empty($options['links'])) { ?>
                            <ul class="footer-nav">
                                <?php foreach($options['links'] as $name => $url) { ?>
                                    <li><a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a></li>
                                <?php } ?>
                            </ul>
                        <?php } ?>
                    </div>
                    <div class="span5">
                        <div class="pull-right">
                            <?php if (!empty($options['twitter'])) { ?>
                                <?php foreach($options['twitter'] as $handle) { ?>
                                    <div class="twitter">
                                        <iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=<?php echo $handle;?>&amp;show_count=false"></iframe>
                                    </div>
                                <?php } ?>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    <?php } else { ?>
        <!-- Docs -->
        <?php if ($options['repo']) { ?>
            <a href="https://github.com/{$options.repo}" target="_blank" id="github-ribbon"><img src="__ADDONROOT__/img/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
        <?php } ?>
        <div class="container-fluid fluid-height wrapper">
            <div class="navbar navbar-fixed-top">
                <div class="navbar-inner">
                    <a class="brand pull-left" href="__ADDONROOT__<?php echo $homepage_url;?>">{$options.title}</a>
                    <p class="navbar-text pull-right">
                        Generated by <a href="{:U('/')}">{:C('WEB_SITE_NAME')}</a>
                    </p>
                </div>
            </div>

            <div class="row-fluid columns content">
                <div class="left-column article-tree span3">
                    <!-- For Mobile -->
                    <div class="responsive-collapse">
                        <button type="button" class="btn btn-sidebar" id="menu-spinner-button">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                    </div>
                    <div id="sub-nav-collapse" class="sub-nav-collapse">
                        <!-- Navigation -->
                        <?php echo build_nav($tree, $url_params); ?>

                        <?php if (!empty($options['links']) || !empty($options['twitter'])) { ?>
                            <div class="well well-sidebar">
                                <!-- Links -->
                                <?php foreach($options['links'] as $name => $url) { ?>
                                    <a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a><br>
                                <?php } ?>
                                <!-- Twitter -->
                                <?php foreach($options['twitter'] as $handle) { ?>
                                    <div class="twitter">
                                                <hr/>
                                        <iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=<?php echo $handle;?>&amp;show_count=false"></iframe>
                                    </div>
                                <?php } ?>
                            </div>
                        <?php } ?>
                    </div>
                </div>
                <div class="right-column <?php echo ($options['float']?'float-view':''); ?> content-area span9">
                    <div class="content-page">
                        <article>
                            <?php
                                if(!setlocale(LC_TIME,'zh_CN.UTF-8'))
                                setlocale(LC_TIME,'chinese.GB2312');
                            ?>
                            <?php if($options['date_modified'] && isset($page['modified'])) { ?>
                                <div class="page-header sub-header clearfix">
                                    <h1>{$page.title}</h1>
                                        <span style="float: left; font-size: 10px; color: gray;">
                                            <?php echo date("l, F j, Y", $page['modified']);?>
                                        </span>
                                        <span style="float: right; font-size: 10px; color: gray;">
                                            <?php echo date ("g:i A", $page['modified']);?>
                                        </span>
                                </div>
                            <?php } else { ?>
                                <div class="page-header">
                                    <h1>{$page.title}</h1>
                                </div>

                            <?php } ?>
                            <?php echo $page['html'];?>
                        </article>
                    </div>
                </div>
            </div>
        </div>
    <?php } ?>

    <?php if ($options['google_analytics']) { ?>
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', '{$options.google_analytics}', '{$_SERVER['HTTP_HOST']}');
      ga('send', 'pageview');

    </script>
    <?php } ?>
    <?php if ($options['piwik_analytics']) { ?>
    <script type="text/javascript">
      var _paq = _paq || [];
      _paq.push(["trackPageView"]);
      _paq.push(["enableLinkTracking"]);

      (function() {
        var u=(("https:" == document.location.protocol) ? "https" : "http") + "://{$options.piwik_analytics}/";
        _paq.push(["setTrackerUrl", u+"piwik.php"]);
        _paq.push(["setSiteId", "1"]);
        var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
        g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <?php } ?>
</body>
</html>
